package cn.xluobo.business.wechat.miniapp.student.controller;

import cn.xluobo.business.sc.student.service.BusinessScStudentService;
import cn.xluobo.business.wechat.miniapp.student.domain.resp.RespIndexBarStudent;
import cn.xluobo.business.wechat.miniapp.student.service.WechatMiniStudentService;
import cn.xluobo.core.api.APIResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author ：KingLong
 * @date ：Created in 2020/11/11 19:12
 */
@RestController
@RequestMapping("/api/wechat/miniapp/{appId}/student")
public class WechatMiniStudentController {

    @Autowired
    private WechatMiniStudentService wechatMiniStudentService;
    @Autowired
    private BusinessScStudentService businessScStudentService;

    /**
     * 学员idnex bar 列表
     * @return
     */
    @GetMapping("/searchIndexBarStudentList")
    public APIResponse searchIndexBarStudentList() {
        List<RespIndexBarStudent> studentList = wechatMiniStudentService.searchIndexBarStudentList();
        return APIResponse.toAPIResponse(studentList);
    }

    /**
     * 详情
     *
     * @param studentId
     * @return
     */
    @GetMapping("/studentDetail/{studentId}")
    public APIResponse detailById(@PathVariable("studentId") Long studentId) {
        return businessScStudentService.detailById(studentId);
    }
}
